home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / The_Last_H20903111112007.psc / The Last Hope / cGoody.cls < prev    next >
Text File  |  2007-11-11  |  2KB  |  74 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cGoody"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. 'This Class Controls all operations regarding Goodies like
  15. 'Creating and determining the type of goodies
  16. 'Implementing their Effects etc
  17.  
  18.  
  19. Public Sub DoGoody()
  20. Dim Collision As New cCollision
  21. If GoodyTime > 5 Then
  22. GoodyPresent = False
  23. End If
  24.     DisplayGoody
  25.     If Collision.CheckCollisionGS(GoodyX, GoodyY) Then
  26.     Score = Score + 500
  27.     UseGoody
  28.     GoodyPresent = False
  29. End If
  30. Set Collision = Nothing
  31. End Sub
  32.  
  33. Public Function CreateGoody(ByVal Xcord As Integer, ByVal Ycord As Integer) As String
  34. Randomize
  35. GoodyPresent = True
  36. GoodyX = Xcord
  37. GoodyY = Ycord
  38. GoodyT = Int(Rnd * 4 + 1)
  39. CreateGoody = TranslateGoody()
  40. GoodyTime = 0
  41. End Function
  42.  
  43. Private Function TranslateGoody() As String
  44. Select Case GoodyT
  45.     Case 1
  46.     TranslateGoody = "S"
  47.     Case 2
  48.     TranslateGoody = "W"
  49.     Case 3
  50.     TranslateGoody = "L"
  51.     Case 4
  52.     TranslateGoody = "B"
  53. End Select
  54. End Function
  55.  
  56. Private Sub UseGoody()
  57. Select Case TranslateGoody
  58. Case "S"
  59. If ShipSpeed < 5 Then ShipSpeed = ShipSpeed + 1
  60. Case "W"
  61. If FireQuality < 3 Then FireQuality = FireQuality + 1
  62. Case "L"
  63. If Lives < 6 Then Lives = Lives + 1
  64. Case "B"
  65. BombNumber = BombNumber + 1
  66. End Select
  67. End Sub
  68.  
  69. Private Sub DisplayGoody()
  70. SetTextColor MemDc, vbGreen
  71. TextOut MemDc, GoodyX, GoodyY, TranslateGoody(), 1
  72. SetTextColor MemDc, vbWhite
  73. End Sub
  74.